<?php
/**
 * @author Amissah Gideon<kuulmek@yahoo.com>
 * @access public
 * @version 1.0
 */
/*
$equipmentObj =  ClassRegistry::init('Items');
$equipment_data = Set::combine($equipmentObj->find('all',array('fields'=>array('id','name','amount'),'conditions' => array('deleted'=>'n'),'recursive'=>-1)),'{n}.Items.id', '{n}.Items');
$equipmentOpt = array();
$global_equipment_data = array();
foreach($equipment_data as $value){
    $equipmentOpt[$value['id']] = $value['name'];
    $global_equipment_data[$value['id']] = array('name'=>$value['name'], 'amount'=>$value['amount']);
}*/
?>
<!--<script type="text/javascript">
    var global_equipment_data = <?php /*echo json_encode($global_equipment_data); */?>;
    //console.log(global_equipment_data);
</script>-->

<!-- Main content -->
<section role="main" id="main">

    <!-- Header -->
    <?php echo $this->element('page_header'); ?>

    <div class="with-padding">
        <div class="columns">
            <div class="new-row-mobile twelve-columns six-columns-tablet twelve-columns-mobile">

                <h3 class="thin underline">Add, Edit and Delete Customers</h3>

                <table id="flex" style="display:none;"></table>

                <div style="display: none;">
                    <div id="form-window" style="margin: 20px 5px 5px 5px;">
                        <div class="prompt" ></div>
                        <?php echo $this->Form->create('Customer', array('default' => false, 'id' => 'form', 'action' => 'add','inputDefaults' => array('label' => false,'div' => false)));?>
                        <fieldset class="fieldset">
                            <legend class="legend">Info</legend>

                            <p class="button-height inline-label">
                                <img id="pic_placeholder" path="/japlantpool/img/customers_files/" src="/japlantpool/img/" style="display: none" alt="" width="100" height="100" border="0">
                            </p>

                            <p class="button-height inline-label">
                                <label class="label">Name:</label>
                                <?php echo $this->Form->input('name', array('id'=>'name', 'class' => 'input validate[required] ', 'div' => false, 'label' => false,)); ?>
                            </p>
                            <p class="button-height inline-label">
                                <label class="label">Customer Type:</label>
                                <?php echo $this->Form->input('customer_type', array('id'=>'customer_type', 'class' => 'select validate[required] ', 'options'=>$customer_types_opt, 'div' => false, 'label' => false,)); ?>
                            </p>
                            <p class="button-height inline-label">
                                <label class="label">Certificate of Incorporation:</label>
                                <?php echo $this->Form->input('certificate_no', array('id'=>'certificate_no', 'class' => 'input' ,'value'=>'', 'div' => false, 'label' => false,)); ?>
                            </p>

                            <p class="button-height inline-label">
                                <label class="label">Date of Commencement:</label>
                                <span class="input">
                                    <?php echo $this->Form->input('date_of_commence', array('type'=>'text','id'=>'date_of_commence', 'class' => 'input-unstyled','div' => false, 'label' => false,)); ?>
                                    <!--<input type="text" name="pseudo-input-1" id="pseudo-input-1" class="input-unstyled" value="Value">-->
                                    <a href="javascript:void(0)" class="button compact" id="date_of_commence_btn">Date</a>
                                </span>
                            </p>

                            <p class="button-height inline-label">
                                <label class="label">Contact Person:</label>
                                <?php echo $this->Form->input('contact_person', array('id'=>'contact_person', 'class' => 'input validate[required]' ,'value'=>'', 'div' => false, 'label' => false,)); ?>
                            </p>

                            <p class="button-height inline-label">
                                <label class="label">Telephone:</label>
                                <?php echo $this->Form->input('phone_number', array('id'=>'phone_number', 'class' => 'input validate[required]' ,'value'=>'', 'div' => false, 'label' => false,)); ?>
                            </p>

                            <p class="button-height inline-label">
                                <label class="label">Email:</label>
                                <?php echo $this->Form->input('email', array('id'=>'email', 'class' => 'input' ,'value'=>'', 'div' => false, 'label' => false,)); ?>
                            </p>

                            <p class="button-height inline-label">
                                <label class="label">Address:</label>
                                <?php echo $this->Form->input('address', array('id'=>'address', 'class' => 'input' ,'value'=>'', 'div' => false, 'label' => false,)); ?>
                            </p>

                            <p class="button-height inline-label">
                                <label class="label">Region:</label>
                                <?php echo $this->Form->input('region_id', array('id'=>'region_id', 'class' => 'select expandable-list', 'style'=>'width:170px;','options'=>$region_list ,'value'=>'', 'div' => false, 'label' => false,)); ?>
                            </p>

                            <p class="button-height inline-label">
                                <label class="label">City:</label>
                                <?php echo $this->Form->input('city', array('id'=>'city', 'class' => 'input' ,'value'=>'', 'div' => false, 'label' => false,)); ?>
                            </p>

                            <p class="button-height inline-label">
                                <label class="label">Location:</label>
                                <?php echo $this->Form->input('physical_location', array('type'=>'text','id'=>'physical_location', 'class' => 'input validate[required]' ,'value'=>'', 'div' => false, 'label' => false,)); ?>
                            </p>

                            <p class="button-height inline-label">
                                <label class="label">Country:</label>
                                <?php echo $this->Form->input('country_id', array('id'=>'country_id', 'class' => 'select expandable-list validate[required]', 'style'=>'width:170px;','options'=>$country_list, 'div' => false, 'label' => false,)); ?>
                            </p>

                            <p class="button-height inline-label">
                                <label class="label">Comments:</label>
                                <?php echo $this->Form->input('comments', array('id'=>'comments', 'class' => 'input full-width validate[required]', 'div' => false, 'label' => false,)); ?>
                            </p>

                            <p class="button-height inline-label">
                                <label for="save-btn" class="label">&nbsp;</label>
                                <button type="submit" class="button" id="save-btn">
                                    <span class="button-icon green-gradient"><span class="icon-download"></span></span>
                                    Save
                                </button>

                                <button type="button" class="button" id="cancel-btn">
                                    <span class="button-icon anthracite-gradient"><span class="icon-cross-round"></span></span>
                                    Cancel
                                </button>
                            </p>
                        </fieldset>

                        <?php echo $this->Form->end();?>
                    </div>
                </div>

            </div>
        </div>
    </div>

</section>
<!-- End main content -->

<!-- Side tabs shortcuts -->
<?php echo $this->element('side_tabs_shortcuts'); ?>
<!-- Sidebar/drop-down menu -->
<?php echo $this->element('right_side_infos'); ?>


<!-- Users URL -->
<input type="hidden" id="table-url" value="<?php echo $this->Html->url(array('controller' => 'Customers', 'action' => 'getCustomers')); ?>" />
<input type="hidden" id="add-edit-url" value="<?php echo $this->Html->url(array('controller' => 'Customers', 'action' => 'add')); ?>" />
<input type="hidden" id="load-user-url" value="<?php echo $this->Html->url(array('controller' => 'Customers', 'action' => 'loadCustomer')); ?>" />
<input type="hidden" id="delete-url" value="<?php echo $this->Html->url(array('controller' => 'Customers', 'action' => 'deleteCustomers')); ?>" />
<input type="hidden" id="upload-url" value="<?php echo $this->Html->url(array('controller' => 'Customers', 'action' => 'import')); ?>" />


<?php
echo $this->Html->script('setup.js');

/** Template functions **/
echo $this->Html->script('developr.input.js');
echo $this->Html->script('developr.message.js');
echo $this->Html->script('developr.modal.js');
echo $this->Html->script('developr.navigable.js');
echo $this->Html->script('developr.notify.js');
echo $this->Html->script('developr.scroll.js');
echo $this->Html->script('developr.progress-slider.js');
echo $this->Html->script('developr.tooltip.js');
echo $this->Html->script('developr.confirm.js');
echo $this->Html->script('developr.agenda.js');
echo $this->Html->script('developr.tabs.js');

echo $this->Html->script('libs/tinycon.min.js');
echo $this->Html->script('jquery.thfloat-0.3.min.js');
echo $this->Html->script('custom-scripts/customers.js');
?>
